// @ts-ignore
/* eslint-disable */
import { request } from 'umi';
import { RiskBody } from '@/pages/Defense/Database/Risk/data';
import {RiskMonthCountItem, RiskSystemListItem} from '@/pages/Defense/System/Risk/data';

export async function dataList(params: {
  // query
  /** 当前的页码 */
  current?: number;
  /** 页面的容量 */
  pageSize?: number;
}) {
  return request<{
    data: RiskSystemListItem[];
    /** 列表的内容总数 */
    total?: number;
    success?: boolean;
  }>('/v2/enterprise/risk/system/main', {
    method: 'GET',
    params: {
      ...params,
    },
  });
}
export async function monthCountDataList(params: {
  // query
  /** 当前的页码 */
  current?: number;
  /** 页面的容量 */
  pageSize?: number;
}) {
  return request<{
    data: RiskMonthCountItem[];
    /** 列表的内容总数 */
    total?: number;
    success?: boolean;
  }>('/v2/enterprise/risk/system/main/item', {
    method: 'GET',
    params: {
      ...params,
    },
  });
}

export async function postCountDataList(params: {
  // query
  /** 当前的页码 */
  current?: number;
  /** 页面的容量 */
  pageSize?: number;
}) {
  return request<{
    data: RiskMonthCountItem[];
    /** 列表的内容总数 */
    total?: number;
    success?: boolean;
  }>('/v2/enterprise/risk/system/main/post', {
    method: 'GET',
    params: {
      ...params,
    },
  });
}
export async function personDataList(params: {
  // query
  /** 当前的页码 */
  current?: number;
  /** 页面的容量 */
  pageSize?: number;
}) {
  return request<{
    data: RiskMonthCountItem[];
    /** 列表的内容总数 */
    total?: number;
    success?: boolean;
  }>('/v2/enterprise/risk/system/main/person-list', {
    method: 'GET',
    params: {
      ...params,
    },
  });
}

export async function getRisk(param: { riskId?: number }): Promise<{ data: RiskBody }> {
  console.log(param);
  return request(`/v2/enterprise/risk/${param.riskId}`, { method: 'GET' });
}

export async function addRisk(param: RiskBody): Promise<{ data: number }> {
  return request('/v2/enterprise/risk', { method: 'RISK', data: param });
}

export async function updateRisk(param: RiskBody): Promise<{ data: number }> {
  return request('/v2/enterprise/risk', { method: 'PUT', data: param });
}

export async function removeRisk(data: number[], options?: { [key: string]: any }) {
  return request<Record<string, any>>(`/v2/enterprise/risk/` + data.join(), {
    method: 'DELETE',
    ...(options || {}),
  });
}
